3.1319 \(\int (c (d \tan (e+f x))^p)^n (a+i a \tan (e+f x))^2 \, dx\)

Optimal. Leaf size=93 \[ -\frac {a^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)}+\frac {2 a^2 \tan (e+f x) \, _2F_1(1,n p+1;n p+2;i \tan (e+f x)) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)} \]

[Out]

-a^2*tan(f*x+e)*(c*(d*tan(f*x+e))^p)^n/f/(n*p+1)+2*a^2*hypergeom([1, n*p+1],[n*p+2],I*tan(f*x+e))*tan(f*x+e)*(
c*(d*tan(f*x+e))^p)^n/f/(n*p+1)

________________________________________________________________________________________

Rubi [A]  time = 0.21, antiderivative size = 93, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {1586, 6677, 80, 64} \[ -\frac {a^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)}+\frac {2 a^2 \tan (e+f x) \, _2F_1(1,n p+1;n p+2;i \tan (e+f x)) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)} \]

Antiderivative was successfully verified.

[In]

Int[(c*(d*Tan[e + f*x])^p)^n*(a + I*a*Tan[e + f*x])^2,x]

[Out]

-((a^2*Tan[e + f*x]*(c*(d*Tan[e + f*x])^p)^n)/(f*(1 + n*p))) + (2*a^2*Hypergeometric2F1[1, 1 + n*p, 2 + n*p, I
*Tan[e + f*x]]*Tan[e + f*x]*(c*(d*Tan[e + f*x])^p)^n)/(f*(1 + n*p))

Rule 64

Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(c^n*(b*x)^(m + 1)*Hypergeometric2F1[-n, m +
 1, m + 2, -((d*x)/c)])/(b*(m + 1)), x] /; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[m] && (IntegerQ[n] || (GtQ[
c, 0] &&  !(EqQ[n, -2^(-1)] && EqQ[c^2 - d^2, 0] && GtQ[-(d/(b*c)), 0])))

Rule 80

Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(b*(c + d*x)
^(n + 1)*(e + f*x)^(p + 1))/(d*f*(n + p + 2)), x] + Dist[(a*d*f*(n + p + 2) - b*(d*e*(n + 1) + c*f*(p + 1)))/(
d*f*(n + p + 2)), Int[(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && NeQ[n + p + 2,
0]

Rule 1586

Int[(u_.)*(Px_)^(p_.)*(Qx_)^(q_.), x_Symbol] :> Int[u*PolynomialQuotient[Px, Qx, x]^p*Qx^(p + q), x] /; FreeQ[
q, x] && PolyQ[Px, x] && PolyQ[Qx, x] && EqQ[PolynomialRemainder[Px, Qx, x], 0] && IntegerQ[p] && LtQ[p*q, 0]

Rule 6677

Int[(u_)*((c_.)*((a_.) + (b_.)*(x_))^(n_))^(p_), x_Symbol] :> Dist[(c^IntPart[p]*(c*(a + b*x)^n)^FracPart[p])/
(a + b*x)^(n*FracPart[p]), Int[u*(a + b*x)^(n*p), x], x] /; FreeQ[{a, b, c, n, p}, x] &&  !IntegerQ[p] &&  !Ma
tchQ[u, x^(n1_.)*(v_.) /; EqQ[n, n1 + 1]]

Rubi steps

\begin {align*} \int \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^2 \, dx &=\frac {\operatorname {Subst}\left (\int \frac {\left (c (d x)^p\right )^n (a+i a x)^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\operatorname {Subst}\left (\int \frac {\left (c (d x)^p\right )^n (a+i a x)}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\left ((d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \operatorname {Subst}\left (\int \frac {(d x)^{n p} (a+i a x)}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {a^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {\left (2 a (d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \operatorname {Subst}\left (\int \frac {(d x)^{n p}}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {a^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {2 a^2 \, _2F_1(1,1+n p;2+n p;i \tan (e+f x)) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 2.30, size = 185, normalized size = 1.99 \[ \frac {a^2 e^{-2 i e} 2^{-n p} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^{n p+1} (\cos (e+f x)+i \sin (e+f x))^2 \left (-2^{n p}+\left (1+e^{2 i (e+f x)}\right )^{n p+1} \, _2F_1\left (n p+1,n p+1;n p+2;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )\right ) \tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{(f n p+f) (\cos (f x)+i \sin (f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(c*(d*Tan[e + f*x])^p)^n*(a + I*a*Tan[e + f*x])^2,x]

[Out]

(a^2*(((-I)*(-1 + E^((2*I)*(e + f*x))))/(1 + E^((2*I)*(e + f*x))))^(1 + n*p)*(-2^(n*p) + (1 + E^((2*I)*(e + f*
x)))^(1 + n*p)*Hypergeometric2F1[1 + n*p, 1 + n*p, 2 + n*p, (1 - E^((2*I)*(e + f*x)))/2])*(Cos[e + f*x] + I*Si
n[e + f*x])^2*(c*(d*Tan[e + f*x])^p)^n)/(2^(n*p)*E^((2*I)*e)*(f + f*n*p)*(Cos[f*x] + I*Sin[f*x])^2*Tan[e + f*x
]^(n*p))

________________________________________________________________________________________

fricas [F]  time = 0.70, size = 0, normalized size = 0.00 \[ {\rm integral}\left (\frac {4 \, a^{2} e^{\left (n p \log \left (\frac {-i \, d e^{\left (2 i \, f x + 2 i \, e\right )} + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right ) + 4 i \, f x + n \log \relax (c) + 4 i \, e\right )}}{e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, e^{\left (2 i \, f x + 2 i \, e\right )} + 1}, x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

integral(4*a^2*e^(n*p*log((-I*d*e^(2*I*f*x + 2*I*e) + I*d)/(e^(2*I*f*x + 2*I*e) + 1)) + 4*I*f*x + n*log(c) + 4
*I*e)/(e^(4*I*f*x + 4*I*e) + 2*e^(2*I*f*x + 2*I*e) + 1), x)

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} \left (\left (d \tan \left (f x + e\right )\right )^{p} c\right )^{n}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((I*a*tan(f*x + e) + a)^2*((d*tan(f*x + e))^p*c)^n, x)

________________________________________________________________________________________

maple [F(-1)]  time = 180.00, size = 0, normalized size = 0.00 \[ \int \left (c \left (d \tan \left (f x +e \right )\right )^{p}\right )^{n} \left (a +i a \tan \left (f x +e \right )\right )^{2}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^2,x)

[Out]

int((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^2,x)

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} \left (\left (d \tan \left (f x + e\right )\right )^{p} c\right )^{n}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((I*a*tan(f*x + e) + a)^2*((d*tan(f*x + e))^p*c)^n, x)

________________________________________________________________________________________

mupad [F]  time = 0.00, size = -1, normalized size = -0.01 \[ \int {\left (c\,{\left (d\,\mathrm {tan}\left (e+f\,x\right )\right )}^p\right )}^n\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^2 \,d x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c*(d*tan(e + f*x))^p)^n*(a + a*tan(e + f*x)*1i)^2,x)

[Out]

int((c*(d*tan(e + f*x))^p)^n*(a + a*tan(e + f*x)*1i)^2, x)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ - a^{2} \left (\int \left (- \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n}\right )\, dx + \int \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \tan ^{2}{\left (e + f x \right )}\, dx + \int \left (- 2 i \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \tan {\left (e + f x \right )}\right )\, dx\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*(d*tan(f*x+e))**p)**n*(a+I*a*tan(f*x+e))**2,x)

[Out]

-a**2*(Integral(-(c*(d*tan(e + f*x))**p)**n, x) + Integral((c*(d*tan(e + f*x))**p)**n*tan(e + f*x)**2, x) + In
tegral(-2*I*(c*(d*tan(e + f*x))**p)**n*tan(e + f*x), x))

________________________________________________________________________________________